home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 October: Mac OS SDK / Dev.CD Oct 00 SDK1.toast / Development Kits / Mac OS / AIAT / Headers / Storage / HFSStoreStream.h < prev    next >
Encoding:
Text File  |  1998-04-16  |  2.0 KB  |  88 lines  |  [TEXT/CWIE]

  1. // HFSStoreStream.h
  2. //    Copyright:    © 1994 - 1998 by Apple Computer, Inc., all rights reserved.
  3.  
  4.  
  5. // Implements IAStoreStream for a Macintosh HFS file.
  6.  
  7. #pragma once
  8. #ifndef HFSStoreStream_h
  9. #define HFSStoreStream_h
  10.  
  11. #pragma import on
  12.  
  13. #if PRAGMA_STRUCT_ALIGN
  14.     #pragma options align=power
  15. #endif
  16.  
  17. #include "IAStoreStream.h"
  18.  
  19. #include <Devices.h>
  20. #include <Files.h>
  21.  
  22. #pragma IA_BEGIN_EXPORTS
  23.  
  24. class HFSStoreStream : public IAStoreStream {
  25. public:
  26.             HFSStoreStream(short vRef, long dirId, const StringPtr fileName,
  27.                            OSType creator = 'VTWN', OSType fileType = 'STOR');
  28.             ~HFSStoreStream();
  29.  
  30.     void            Initialize();
  31.     void            Open(bool writable);
  32.  
  33.     bool            IsOpen();
  34.     bool            IsWritable();
  35.  
  36.     void            Flush();
  37.  
  38.     uint32            GetEOF();
  39.     void            SetEOF(uint32 address);
  40.  
  41.     virtual IAStoreStream*    Clone();
  42.     
  43.     OSType            GetCreator() const {return creator;}
  44.     OSType            GetFileType() const {return fileType;}
  45.     const short        GetVRefNum() const {return vRefNum;}
  46.     const long        GetDirID() const {return dirID;}
  47.     StringPtr        GetFileName() const {return fileName;}
  48.     short            GetFRefNum() const {return fRefNum;}
  49.     void            SetFRefNum(short fref) {fRefNum = fref;}  // better be open!
  50.     
  51. protected:
  52.             // constructor for use by Clone()
  53.             HFSStoreStream(short vRef, long dirId, const StringPtr fileName,
  54.                            OSType creator, OSType fileType, bool isOpen, bool isWritable,
  55.                            short fRefNum);
  56.  
  57.     void            Write(uint32 address, const byte* data, uint32 length);
  58.     uint32            Read(uint32 address, byte* data,  uint32 length);
  59.  
  60. private:
  61.                     HFSStoreStream(HFSStoreStream&);    // don't define a copy constructor
  62.  
  63.     bool            isOpen;
  64.     bool            isWritable;
  65.     const bool        isClone;
  66.  
  67.     // for use by Initialize()
  68.     const OSType    creator;
  69.     const OSType    fileType;    
  70.     // for use by Initialize() and Open()
  71.     const short        vRefNum;
  72.     const long        dirID;
  73.     StringPtr         fileName;
  74.     // handle on the open file, for remaining methods
  75.     short            fRefNum;
  76.  
  77. };
  78.  
  79. #pragma IA_END_EXPORTS
  80.  
  81. #if PRAGMA_STRUCT_ALIGN
  82.     #pragma options align=reset
  83. #endif
  84.  
  85. #pragma import reset
  86.  
  87. #endif
  88.